package cn.edu.jxyy.mybatistest.test;

import cn.edu.jxyy.mybatistest.Utils.MyBatisUtils;
import cn.edu.jxyy.mybatistest.mapper.UserMapper;
import cn.edu.jxyy.mybatistest.pojo.User;
import org.apache.ibatis.session.SqlSession;

public class part11_Insert {
    public static void main(String[] args) {
        SqlSession sqlSession = MyBatisUtils.getSession();
        UserMapper mapper = sqlSession.getMapper(UserMapper.class);
        User user = new User();
        user.setUname("abc");
        user.setUage(20);
        int i = mapper.addUser(user);
        System.out.println(i);
        System.out.println(user.getUid());
        sqlSession.commit();
        sqlSession.close();
    }
} 